package com.phone580.app;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;

import com.phone580.app.entity.AppUpgrageInfoEntity;
import com.phone580.app.model.AppUpgradeModel;
import com.phone580.app.net.HttpAccess;

/**
 * 检测手机已安装的所有应用升级
 * @author matthew
 *
 */
public class AppUpgradeTask extends BaseTask {
	
	public AppUpgradeTask(Context context) {
		super(context);
	}
	
	public static AppUpgrageInfoEntity appUpgrade = null;

	@Override
	public void setParams(Object... params) {

	}

	@Override
	protected Object doInBackground(Void... params) {
		String url = "http://www.phone580.com:7001/WebServicePro/mobile.do?method=appUpgrade";
		AppUpgradeModel model = new AppUpgradeModel();
		String request = model.getRequestParams(context);
		Map<String, String> map = new HashMap<String, String>();
		map.put("upgradeInfo", request);
		try {
			String result = HttpAccess.doPostWithResult(url, map);
			AppUpgrageInfoEntity entity = model.parseUpgradeResult(result.trim());
			if (AppUpgradeModel.SUCCESS.equals(entity.getStatus())) {
				appUpgrade = entity;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
	


	
	

}
